package slash.world;

import java.util.*;
import slash.constants.*;

public class World {
	
	/* HashMap of all maps being used by the game */
	private static HashMap<String,Map> MAPS = new HashMap<String,Map>();
	/* Current Map being used */
	private static Map currentMap;
	
	public World(){
		addMap(Globals.BTLG_NAME, Globals.BTLG_PATH);// adds map to world
		currentMap = MAPS.get(Globals.BTLG_NAME);
	}
	
	/**
	 * Returns cache of maps
	 */
	public HashMap<String,Map> getMaps(){
		return MAPS;
	}
	
	/**
	 * Creates and caches a new map
	 * into hashmap.
	 * Par: mapname, path
	 */
	public void addMap(String name, String path){
		Map m = new Map(name,path);
		MAPS.put(name, m);
	}
	
	/**
	 * returns the current map being used
	 */
	public Map getCurrentMap() {
		return currentMap;
	}
	
	/**
	 * Returns map with given name. Returns null if key didn't match
	 * Par: mapname
	 */
	public Map getMap(String key){
		return MAPS.get(key);
	}

}
